package com.alit.ibot.robot.wechat.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.alit.ibot.robot.wechat.service.RobotWechatCommonService;
import com.alit.ibot.robot.wechat.service.RobotWechatVoiceService;
import com.alit.ibot.robot.wechat.util.WechatXMLUtil;

/**
 * @author litong
 * @date 2019年5月31日_下午8:22:10
 * @version 1.0
 * @desc
 */
@Service
public class RobotWechatVoiceServiceImpl implements RobotWechatVoiceService {

  @Autowired
  private RobotWechatCommonService rwcs;

  @Override
  public String getToWechatXML(Map<String, String> requestMap) {
    String question = requestMap.get("Recognition");
    if (StringUtils.isEmpty(question)) {
      return WechatXMLUtil.toWechatTextXML(requestMap, "语音消息没有识别到文字");
    }
    return rwcs.getRobotContentAndConvertToWechatXML(requestMap, question);
  }

}
